#include <functional> // std::ref
#include <iostream>   // std::cout

int main() {
  int foo(10);

  auto bar = std::cref(foo); // bar和foo地址不相同
  int foo1 = foo;            // foo1和foo地址相同
  ++foo;
  std::cout << "ref address: " << &bar << " origin address:" << &foo
            << " foo address: " << &foo << " ref value: " << bar
            << " origin value:" << foo << '\n';
  return 0;
}
